﻿using System.Xml.Linq;
using IcicleFramework.Components;
using IcicleFramework.Entities;

namespace IcicleFramework.GameServices
{
    public interface IComponentFactory : IService
    {
        /// <summary>
        /// Generates the IBaseComponent described in the XElement.
        /// </summary>
        /// <param name="element">The XElement containing the definition of the IBaseComponent to create.</param>
        /// <returns>The IBaseComponent requested, or null if the XElement did not contain a valid component definition.</returns>
        IBaseComponent GenerateComponent(XElement element);

        /// <summary>
        /// Generates the IBaseComponent described in the XElement and assigns it to the provided IGameObject.
        /// </summary>
        /// <param name="element">The XElement containing the definition of the IBaseComponent to create.</param>
        /// <param name="parent">The IGameObject the newly generated IBaseComponent will belong to.</param>
        /// <returns>The IBaseComponent requested, or null if the XElement did not contain a valid component definition.</returns>
        IBaseComponent GenerateComponent(XElement element, IGameObject parent);
    }
}
